package com.qd.common.panda.domain.entity.card;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cdqidi.util.page.BaseQuery;
import com.cdqidi.valid.group.DefaultGroup;
import com.cdqidi.valid.group.DeleteGroup;
import com.cdqidi.valid.group.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;


/**
 * 兑换码
 *
 * @author sjk
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
@ToString
public class CardPlanRedeemCodeDTO extends BaseQuery {

    @ExcelIgnore
    @JsonIgnore
    private static final String EXCEL_TITLE = "兑换码信息";
    /**
     * 计划ID
     */
    @ExcelProperty(value = {EXCEL_TITLE,"计划ID"})
    @NotBlank(message = "计划ID不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "计划ID长度不能超过{max}位", groups = DefaultGroup.class)
    private String planId;
    /**
     * 计划ID显示
     */
    @ExcelProperty(value = {EXCEL_TITLE,"计划名称"})
    private String planIdDisplay;
    /**
     * 主键
     */
    @ExcelProperty(value = {EXCEL_TITLE, "兑换码"})
    @NotBlank(message = "兑换码不能为空", groups = {DeleteGroup.class, UpdateGroup.class})
    @Size(max = 16, message = "兑换码长度不能超过{max}位", groups = {DeleteGroup.class, UpdateGroup.class})
    private String redeemCode;

    /**
     * 已兑换的用户ID
     */
    @ExcelIgnore
    @JsonIgnore
    private String userId;

    @Override
    public void freeData() {
        this.redeemCode = null;
        this.planId = null;
        this.planIdDisplay = null;
        this.userId = null;
        super.freeData();
    }
}
